//
//  HSBC_World.m
//  Bracelet
//
//  Created by Jayce on 15/3/10.
//  Copyright (c) 2015年 jing zhao. All rights reserved.
//

#import "HSBC_World.h"
#import "APIHSBCWord.h"

@interface HSBC_World ()<UIWebViewDelegate>
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *ui_activity;

@end

@implementation HSBC_World

-(void)initWithType:(NSString*)type{
    
    [self.ui_activity startAnimating];
//    [self updateNetwork];
    self.ui_webView.delegate = self;
}

-(void)updateNetwork
{
    UIRefreshTableView *refresh = (UIRefreshTableView*)self.superview;
  [APIHSBCWord getHSBCWorldWithData:@{@"flag":@"world"} Success:^(APIHSBCWord *world) {
        [self.ui_webView loadHTMLString:world.strHtml baseURL:nil];
        [self.ui_activity stopAnimating];
        [refresh endRefreshData];
    } failure:^(NSError *error) {
        [self.ui_activity stopAnimating];
        [refresh endRefreshData];
    }];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    self.ui_webView.scrollView.contentSize = CGSizeMake(webView.frame.size.width, webView.scrollView.contentSize.height);
}

@end
